<?php

namespace common\models\buss;

use Yii;

/**
 * This is the model class for table "{{%buss_devices}}".
 *
 * @property int $id
 * @property int $department_id 部门ID（关联base_department表）
 * @property int $project_id
 * @property string|null $phone_model 手机型号
 * @property string $name 名称
 * @property int|null $use_mid 设备使用人ID
 * @property int $status 状态【-1：删除、0：禁用、1：启用】
 * @property int $operation_id 操作人ID
 * @property string $operation_name 操作人
 * @property string|null $remark 备注
 * @property int $created_at 添加时间
 * @property int $updated_at 更新时间
 */
class Devices extends \common\models\base\BaseModel
{
    const STATUS_DELETE = -1;// 删除
    const STATUS_INVALID = 0;// 禁用
    const STATUS_ENABLE = 1;// 正常

    public static $statuss = [
        self::STATUS_DELETE => '删除',
        self::STATUS_INVALID => '停用',
        self::STATUS_ENABLE => '正常',
    ];

    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%buss_devices}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['department_id', 'project_id', 'use_mid', 'status', 'operation_id', 'created_at', 'updated_at'], 'integer'],
            [['project_id'], 'required'],
            [['phone_model', 'name'], 'string', 'max' => 50],
            [['operation_name'], 'string', 'max' => 100],
            [['remark'], 'string', 'max' => 255],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'department_id' => '部门ID（关联base_department表）',
            'project_id' => 'Project ID',
            'phone_model' => '手机型号',
            'name' => '名称',
            'use_mid' => '设备使用人ID',
            'status' => '状态【-1：删除、0：禁用、1：启用】',
            'operation_id' => '操作人ID',
            'operation_name' => '操作人',
            'remark' => '备注',
            'created_at' => '添加时间',
            'updated_at' => '更新时间',
        ];
    }
}
